// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //
//  »Project«   Talina Gaming System (TgS) (∂)
//  »File«      TgS Common - Geometry 3D - Mesh [BVT].i_inc
//  »Author«    Andrew Aye (EMail: mailto:andrew.aye@gmail.com, Web: http://www.andrewaye.com)
//  »Version«   4.0
// ------------------------------------------------------------------------------------------------------------------------------ //
//  Copyright: © 2002-2010, Andrew Aye.  All Rights Reserved.
//  This software is free for non-commercial use. Redistribution and use in source and binary forms, with or without modification,
//  are permitted provided that the following conditions are met: 
//    Redistributions of source code must retain this copyright notice, this list of conditions and the following disclaimers. 
//    Redistributions in binary form must reproduce this copyright notice, this list of conditions and the following
//      disclaimers in the documentation and other materials provided with the distribution. 
//  Neither the names of the copyright owner nor the names of its contributors may be used to endorse or promote products derived
//  from this software without specific prior written permission. 
//  The intellectual property rights of the algorithms used reside with Andrew Aye.  You may not use this software, in whole or
//  in part, in support of any commercial product without the express written consent of the author.
//  There is no warranty or other guarantee of fitness of this software for any purpose. It is provided solely "as is".
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= //

TgINLINE TgVOID V(tgGM_Constructor_MB)( V(PCU_TgMESH_BVT) ptgMB0 )
{
    V(tgGM_Constructor_MS)( &ptgMB0->m_tgMS );
}


TgINLINE TgVOID V(tgGM_Reset_MB)( V(PCU_TgMESH_BVT) ptgMB0 )
{
    V(tgGM_Reset_MS)( &ptgMB0->m_tgMS );
}


TgINLINE TgBOOL V(tgGM_Is_Valid_MB)( V(CPCU_TgMESH_BVT) ptgMB1 )
{
    if (!V(tgGM_Is_Valid_MS)( &ptgMB1->m_tgMS ))
    {
        return (TgFALSE);
    };

    return (TgTRUE);
}


TgINLINE V(TgVEC) V(tgGM_Support_Point_MB)( V(CPCU_TgMESH_BVT) ptgMB1, V(CPCU_TgVEC) ptvDN )
{
    return (V(tgGM_Support_Point_MS)( &ptgMB1->m_tgMS, ptvDN ));
}


TgINLINE TYPE V(tgGM_Volume_MB)( V(CPCU_TgMESH_BVT) ptgMB1 )
{
    return (V(tgGM_Volume_MS)( &ptgMB1->m_tgMS ));
}


TgINLINE TYPE V(tgGM_Area_MB)( V(CPCU_TgMESH_BVT) ptgMB1 )
{
    return (V(tgGM_Area_MS)( &ptgMB1->m_tgMS ));
}


TgINLINE TgVOID V(tgGM_BA_MB)( V(PCU_TgBOXAA) ptgBA0, V(CPCU_TgMESH_BVT) ptgMB1 )
{
    V(tgGM_BA_MS)( ptgBA0, &ptgMB1->m_tgMS );
}


TgINLINE TgVOID V(tgGM_Sweep_BA_MB)( V(PCU_TgBOXAA) ptgBA0, V(CPCU_TgMESH_BVT) ptgMB1, V(CPCU_TgVEC) ptvDT )
{
    V(tgGM_BA_MB)( ptgBA0, ptgMB1 );
    V(tgGM_Sweep_BA)( ptgBA0, ptvDT );
}


TgINLINE TgVOID V(tgGM_Project_MB)( PCU_TYPE ptyMin, PCU_TYPE ptyMax, V(CPCU_TgMESH_BVT) ptgMB1, V(CPCU_TgVEC) ptvDN )
{
    V(tgGM_Project_MS)( ptyMin, ptyMax, &ptgMB1->m_tgMS, ptvDN );
}


TgINLINE TgBOOL V(tgGM_Is_Contained_MB)( V(CPCU_TgMESH_BVT) ptgMB1, V(CPCU_TgVEC) ptvS0 )
{
    return (V(tgGM_Is_Contained_MS)( &ptgMB1->m_tgMS, ptvS0 ));
}


TgINLINE TgVOID V(tgGM_TX_MB)( V(PCU_TgMESH_BVT) ptgMB0, M34(CPCU_TgMAT) ptmM0 )
{
    V(tgGM_TX_MS)( &ptgMB0->m_tgMS, ptmM0 );
}


TgINLINE TgVOID V(tgGM_Copy_TX_MB)( V(PCU_TgMESH_BVT) ptgMB0, V(CPCU_TgMESH_BVT) ptgMB1, M34(CPCU_TgMAT) ptmM0 )
{
    V(tgGM_Init_MB)( ptgMB0, ptgMB1->m_tgMS.m_nuiVert, ptgMB1->m_tgMS.m_nuiIndx );
    V(tgGM_Copy_TX_MS)( &ptgMB0->m_tgMS, &ptgMB1->m_tgMS, ptmM0 );
}


TgINLINE TgVOID V(tgGM_Init_TX_MB)( V(PCU_TgMESH_BVT) ptgMB0, V(CPCU_TgMESH_SIMPLE) ptgMS, M34(CPCU_TgMAT) ptmM0 )
{
    V(tgGM_Init_MB)( ptgMB0, ptgMS->m_nuiVert, ptgMS->m_nuiIndx );
    V(tgGM_Copy_TX_MS)( &ptgMB0->m_tgMS, ptgMS, ptmM0 );
}


TgINLINE TgVOID V(tgGM_Init_MS_MB)( V(PCU_TgMESH_BVT) ptgMB0, V(CPCU_TgMESH_SIMPLE) ptgMS )
{
    V(tgGM_Init_MB)( ptgMB0, ptgMS->m_nuiVert, ptgMS->m_nuiIndx );
    V(tgGM_Copy_MS)( &ptgMB0->m_tgMS, ptgMS );
}


TgINLINE TgVOID V(tgGM_Copy_MB)( V(PCU_TgMESH_BVT) ptgMB0, V(CPCU_TgMESH_BVT) ptgMB1 )
{
    V(tgGM_Init_MB)( ptgMB0, ptgMB1->m_tgMS.m_nuiVert, ptgMB1->m_tgMS.m_nuiIndx );
    V(tgGM_Copy_MS)( &ptgMB0->m_tgMS, &ptgMB1->m_tgMS );
}


TgINLINE TgVOID V(tgGM_Init_MB)( V(PCU_TgMESH_BVT) ptgMB0, C_TgUINT32 nuiVert, C_TgUINT32 nuiIndx )
{
    V(tgGM_Init_MS)( &ptgMB0->m_tgMS, nuiVert, nuiIndx );
}


TgINLINE CP_TgUINT16 V(tgGM_Query_Indx_List_MB)( V(CPCU_TgMESH_BVT) ptgMB0 )
{
    return (V(tgGM_Query_Indx_List_MS)( &ptgMB0->m_tgMS ));
}


TgINLINE V(CP_TgVEC) V(tgGM_Query_Vert_List_MB)( V(CPCU_TgMESH_BVT) ptgMB0 )
{
    return (V(tgGM_Query_Vert_List_MS)( &ptgMB0->m_tgMS ));
}


TgINLINE TgUINT32 V(tgGM_Query_Indx_Count_MB)( V(CPCU_TgMESH_BVT) ptgMB0 )
{
    return (V(tgGM_Query_Indx_Count_MS)( &ptgMB0->m_tgMS ));
}


TgINLINE TgUINT32 V(tgGM_Query_Vert_Count_MB)( V(CPCU_TgMESH_BVT) ptgMB0 )
{
    return (V(tgGM_Query_Vert_Count_MS)( &ptgMB0->m_tgMS ));
}